<?php 
class PluginsAction extends BaseAction{
	
	function init(){
		if(extension_loaded('zlib')){//检查服务器是否开启了zlib拓展
	    	ob_start('ob_gzhandler');
	  	}
	  	header ("content-type: text/javascript; charset: UTF-8");//注意修改到你的编码
	  	header ("cache-control: must-revalidate");
	  	$offset = 60 * 60 * 24;//css文件的距离现在的过期时间，这里设置为一天
	  	$expire = "expires: " . gmdate ("D, d M Y H:i:s", time() + $offset) . " GMT";
	  	header ($expire);
	  	ob_start("compress");
	  	
		//包含你的全部css和js文档
	  	include __BASE__.'/Public/js/tweet.js';
	  	include __BASE__.'/Public/js/video/control.js';
		include __BASE__.'/Public/js/music/control.js';
		include __BASE__.'/Public/js/image/control.js';
	  	if(extension_loaded('zlib')){
		    ob_end_flush();//输出buffer中的内容，即压缩后的css文件
	  	}
	}
	
	//微博提交前的操作
	function before_publish(){
		$do_type    = 'before_publish';
		$type       = intval($_POST['plugin_id']);
		$pluginInfo = D('Plugin', 'weibo')->getPluginInfoById($type);
		if(!$pluginInfo) return 'No Plugin Info';
		include SITE_PATH.'/apps/weibo/Lib/Plugin/'.$pluginInfo['plugin_path'].'/control.php';
	}
	
	//微博发布成功以后的操作
	function after_publish(){
		
	}
}
?>